HAL RTC alarm functions migration ¶
This section provides information about the HAL RTC alarm functions migration.
Note
The RTC handle is removed in HAL2, so for the following RTC HAL2 functions, the handle will be removed from the parameters.
Related concept: Other HAL RTC changes
HAL RTC set alarm ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc,
RTC_AlarmTypeDef *sAlarm,
uint32_t Format)
|
hal_status_t HAL_RTC_ALARM_SetConfig(hal_rtc_alarm_t alarm,
const hal_rtc_alarm_config_t *p_config_alarm)
hal_status_t HAL_RTC_ALARM_SetDateTime(hal_rtc_alarm_t alarm,
const hal_rtc_alarm_date_time_t *p_date_time)
hal_status_t HAL_RTC_ALARM_Start(hal_rtc_alarm_t alarm,
uint32_t interruption)
|
HAL RTC set alarm it ¶
In HAL2, there is no dedicated function for enabling alarm interrupts.
Instead, you need to follow the same sequence and enable the interrupt by passing it as an argument to the start function using
HAL_RTC_ALARM_IT_ENABLE.
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc,
RTC_AlarmTypeDef *sAlarm,
uint32_t Format)
|
hal_status_t HAL_RTC_ALARM_SetConfig(hal_rtc_alarm_t alarm,
const hal_rtc_alarm_config_t *p_config_alarm)
hal_status_t HAL_RTC_ALARM_SetDateTime(hal_rtc_alarm_t alarm,
const hal_rtc_alarm_date_time_t *p_date_time)
hal_status_t HAL_RTC_ALARM_Start(hal_rtc_alarm_t alarm,
uint32_t interruption)
|
HAL RTC deactivate alarm ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc,
uint32_t Alarm)
|
hal_status_t HAL_RTC_ALARM_Stop(hal_rtc_alarm_t alarm)
|
HAL RTC get alarm ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_RTC_GetAlarm(const RTC_HandleTypeDef *hrtc,
RTC_AlarmTypeDef *sAlarm,
uint32_t Alarm, uint32_t Format)
|
void HAL_RTC_ALARM_GetConfig(hal_rtc_alarm_t alarm,
hal_rtc_alarm_config_t *p_config_alarm)
void HAL_RTC_ALARM_GetDateTime(hal_rtc_alarm_t alarm,
hal_rtc_alarm_date_time_t *p_date_time)
uint32_t HAL_RTC_ALARM_GetBinaryTime(hal_rtc_alarm_t alarm)
|
HAL RTC alarm IRQHandler ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc)
|
void HAL_RTC_ALARM_IRQHandler(void)
|
HAL RTC poll For alarm A event ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(const RTC_HandleTypeDef *hrtc,
uint32_t Timeout)
|
hal_status_t HAL_RTC_ALARM_PollForEvent(hal_rtc_alarm_t alarm,
uint32_t timeout_ms)
|
HAL RTC alarm A event callback ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
|
void HAL_RTC_AlarmAEventCallback(void)
|
HAL RTC alarm B event callback ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc)
|
void HAL_RTC_AlarmBEventCallback(void)
|
HAL RTC poll for alarm B event ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(const RTC_HandleTypeDef *hrtc,
uint32_t Timeout)
|
hal_status_t HAL_RTC_ALARM_PollForEvent(hal_rtc_alarm_t alarm,
uint32_t timeout_ms)
|
Related use cases: HAL RTC alarm use case